from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as  EC
from selenium.webdriver.support.wait import WebDriverWait
import time



driver =webdriver.Chrome()
driver.get('https://www.baidu.com')


kw=WebDriverWait(driver,6).until(EC.presence_of_element_located((By.ID,'kw')),message='aaaa')
# kw=WebDriverWait(driver,6).until_not(EC.presence_of_element_located((By.ID,'kw')),message='aaaa')
print(kw.get_attribute('outerHTML'))


# 找不到元素就会报错
# kw1=WebDriverWait(driver,6).until(EC.presence_of_element_located((By.ID,'kk')),message='aaaa')



time.sleep(2)
driver.quit()
